<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ page import="com.hmsm.sys.po.UserInfo"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>修改系统配置</title>
	<link type="text/css" rel="stylesheet" href="../<s:property value="#session.themeStyle.mainCss" default="Skin/PM/LightBlue/main.css"/>" />
</head>
<body>
	<div class="navBar">
		当前位置：系统管理&gt;&gt;配置信息
	</div>
	<s:form theme="simple">
	<div class="editBlock" style="margin-left: 8px; margin-right: 8px; margin-top: 8px;">
		<table class="inputTable" style="border-collapse:collapse;">
			<tr style="height: 50px;">
				<th colspan="3" style="text-align: center; font-weight: bold; font-size: 16px;">
					修改系统配置
				</th>
			</tr>
			<s:iterator value="sysConfigs" status="status">
			<tr>
				<th style="width:20%;">
					<strong id="name" style="color: #000000;">${name}：</strong>
				</th>
				<td>
					<div class="input_div">
						<s:hidden name="pkId"/>
						<s:if test="selectList==null">
						<input class="sysConfig" name="value" type="text" maxlength="500" style="width: 100%; font-size: 14px; border: 0px;" value='${value}' />
						</s:if><s:else>
						<s:select name="value" list="selectList" listKey="value" listValue="text" emptyOption="true" cssClass="sysConfig" cssStyle="width: 100%; font-size: 14px; border: 0px;"></s:select>
						</s:else>
					</div>
				</td>
				<td id="remark" class="tdTxt" style="width: 20%">
				${remark}
				</td>
			</tr>
			</s:iterator>
			<tr style="color: red;">
				<th>
					<strong>提示：</strong>
				</th>
				<td id="message" style="text-align: left;">
					<s:property value="message" />
				</td>
			</tr>
		</table>
	</div>
	<div class="toolbar" style="text-align: center;">
		<a class="but39" onClick="updateSysConfig()" style="text-decoration: none;">保存</a>
	</div>
	<input type="hidden" id="page" value='<s:property value="sysConfigs.size"/>' />
	</s:form>
	<script src="<%=basePath%>js/jquery.js" type="text/javascript"></script>
	<script src="<%=basePath%>js/store.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function(){
			var message = $.trim($("#message").text());
			if(message!=""){
				alert(message);
				$("#message").empty();
			}
		});  
	
		function updateSysConfig() {
			var from = createFrom("<%=basePath%>sys/sysConfig-save.action");
			var sysConfigs = $(".sysConfig");
			for(var i=0;i<sysConfigs.length;i++){
				var id=	$(sysConfigs[i]).prev().attr("value");
				var value = $.trim($(sysConfigs[i]).val());
				if(value==''){
					alert("参数默认不能为空！");
					return;
				}
				loadFrom("sysConfigMap", id+"|"+value, from);
			}
			from.submit();
		}
	</script>
</body>
</html>
